<template>
    <div v-if="isMobile" class="not-rulePage">
        确认前往数据来源页面? <br/><br/>
        <el-button type="primary" @click="goLink('go')">前往</el-button>
        <el-button @click="goBack">返回</el-button>
    </div>
</template>

<script>
export default {
    data(){
        return {
            isMobile:false,
            uid:null,
        }
    },
    mounted() {
        this.uid = this.$route.query.uid;
        this.isMobile = this._isMobile();
        if (!!this.uid) {
            this.goLink();
        }
    },
    methods: {
        _isMobile() {
            let flag = navigator.userAgent.match(
                /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
            );
            return flag;
        },
        goLink(target) {
            let url = "http://xq.fk.bhbbk.com/product/" + this.uid + ".html";
            if (!this.isMobile) {
                window.open(url);
            } 
            if(target == 'go'){
                location.href = url;
            }
        },
        goBack(){
            this.$router.push("/");
        },
    },
};
</script>
<style lang="scss" scoped>
// 移动端
.not-rulePage {
    font-size: 16px;
    color: #fff;
    box-sizing: border-box;
    padding: 0 20%;
    margin-top: 10vh;
}
</style>